package com.xiaoshuidi.cloud.module.contract.mq.producer;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.common.message.MessageConst;
import org.springframework.cloud.stream.function.StreamBridge;
import org.springframework.integration.support.MessageBuilder;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * @Author Feng
 * @date 2023/7/5
 */
@Component
@Slf4j
public class ContractApplyProducer {

    @Resource
    private StreamBridge streamBridge;

    /**
     * 延期申请 - 到期未支付取消。 默认申请时间两个小时执行取消
     */
    public void extensionCancel(Long id) {
        log.info("延期申请到期未支付, 发送请求： {}", id);
        streamBridge.send("contractApplyExtensionCancel-out-0", MessageBuilder.withPayload(id)
                .setHeader("TAGS", "contractApply")
                .setHeader(MessageConst.PROPERTY_DELAY_TIME_LEVEL, 18).build());
    }
}
